Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow controllers outside of the current namespace using absolute paths #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

GothAck
Copy link
Contributor

@GothAck GothAck commented Jun 27, 2012

Allow routes to be written:

this.namespace('admin', function () { this.match('i_use_another_controller', '/www#action'); this.match('i_use_another_namespace', '/another_namespace/my_cont#action'); });

@jaredhanson
Copy link
Owner

I think I'm with you on this one, but the syntax threw me for a bit of a loop at first glance. Basically, the "shorthand" syntax shouldn't look too "URL-like". Perhaps this:

this.namespace('admin', function () {
  this.match('i_use_another_controller', '::www#action');
  this.match('i_use_another_namespace', '::another_namespace::my_cont#action');
});

Which rewritten in option form, translates into:

this.namespace('admin', function () {
  this.match('i_use_another_controller', { namespace: '', controller: 'www', action: 'action' });
  this.match('i_use_another_namespace', { namespace: 'another_namespace', controller: 'my_cont', action: 'action' });
});

It boils down to adding a syntax to specify namespaces in shorthand notation, and then using fully-qualified forms of those to "back-out" namespaces in the routes.

I'm going to mull over the syntax a bit, and see if I settle on something that feels right. Let me know if you have any ideas.

@GothAck
Copy link
Contributor Author

GothAck commented Jul 11, 2012

Cool, either way is good :) I'm using my patch for a site at the moment once we've got this sorted I'll amend my dependant code to match :)

@GothAck
Copy link
Contributor Author

GothAck commented Dec 22, 2012

You had any thoughts on this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants